require 'json'

class Response
    ## This class gives us an easy api response format, and default values
    attr_accessor :obj, :err

    def initialize(err="", obj={}, args=nil)
        @err = err || ""
        @obj = obj 
    end

    def to_json
        return {
            'err' => @err, 
            'obj' => @obj
        }.to_json
    end
end

module Responder
   def r(err="", obj={}, args=nil)
        return Response.new(err, obj).to_json
    end
end